

const users = {
  state: {
    name: "",
    userId: "",
    headImage:"",
    roleList: "",
    nickname: "",
  },
  mutations: {
    setNickname(state,nickname){
      state.nickname = nickname
    },
    setName(state, name) {
      state.name = name;
    },
    setUserId(state, userId) {
      state.userId = userId;
    },
    setHeadImage(state, headImage){
      state.headImage = headImage
    },
    setRoleList(state, roleList){
      state.roleList = roleList
    }
  },
  getters: {
    name: state => {
      return state.name
    },
    userId: state => {
      return state.userId;
    },
    headImage: state=>{
      return state.headImage;
    },
    roleList: state =>{
      return state.roleList;
    },
    nickname: state =>{
      return state.nickname
    }
  },
  actions: {
    logout(context){
      context.commit("setName","");
      context.commit("setUserId","");
      context.commit("setHeadImage","");
      context.commit("setRoleList","");
      context.commit("setNickname","");
    }
  }
}

export default users;
